package com.sdry.mapper.cb;

import com.sdry.model.cb.ReportFormEntity;
import com.sdry.model.jyy.Receive;
import com.sdry.model.llm.LlmCancellingStocks;
import com.sdry.model.lz.Customer;
import com.sdry.model.lz.Materiel;
import com.sdry.model.lz.OutStockOrder;
import com.sdry.model.lz.WarehouseRegionLocation;
import com.sdry.model.zc.ZcRejectsWarehouseEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @version 1.0
 * @ClassName:
 * @Description: 月报表
 * @Author jyy
 * @Date 2019-04-19 14:30:17
 */
public interface ReportFormMapper {

    List<ReportFormEntity> getMonthBalance(@Param("customer_id") Long customer_id, @Param("strWhere") String strWhere, @Param("date") String date, @Param("wareHouseId") Long wareHouseId, @Param("page") Integer page, @Param("pageSize") Integer pageSize);

    Integer getReportFormListCount(@Param("strWhere") String strWhere, @Param("date") String date, @Param("wareHouseId") Long wareHouseId);

    String getReportFormFirsTime();

    List<Receive> getReportFormJinList(@Param("date") String date, @Param("maName") String maName, @Param("customer_id") Long customer_id, @Param("selectTime") String selectTime, @Param("selectType") String selectType, @Param("selectTime2") String selectTime2, @Param("page") Integer page, @Param("pageSize") Integer pageSize, @Param("stockId") Long stockId);

    List<OutStockOrder> getReportFormChuList(@Param("date") String date, @Param("maName") String maName, @Param("customer_id") Long customer_id, @Param("selectTime") String selectTime, @Param("selectType") String selectType, @Param("selectTime2") String selectTime2, @Param("page") Integer page, @Param("pageSize") Integer pageSize, @Param("stockId") Long stockId);

    List<LlmCancellingStocks> getReportFormReTurnList(@Param("date") String date, @Param("maName") String maName, @Param("customer_id") Long customer_id, @Param("selectTime") String selectTime, @Param("selectType") String selectType, @Param("dateTime2") String dateTime2, @Param("page") Integer page, @Param("pageSize") Integer pageSize, @Param("stockId") Long stockId);

    List<ZcRejectsWarehouseEntity> getReportFormReGeLIList(@Param("date") String date, @Param("maName") String maName, @Param("customer_id") Long customer_id, @Param("selectTime") String selectTime, @Param("selectType") String selectType, @Param("selectTime2") String selectTime2, @Param("page") Integer page, @Param("pageSize") Integer pageSize, @Param("stockId") Long stockId);

    List<ReportFormEntity> getDateBalance(@Param("date") String date, @Param("strWhere") String strWhere, @Param("customer_id") Long customer_id, @Param("wareHouseId") Long wareHouseId, @Param("page") Integer page, @Param("pageSize") Integer pageSize);

    Integer getDateBalanceCount(@Param("date") String date, @Param("strWhere") String strWhere, @Param("customer_id") Long customer_id, @Param("wareHouseId") Long wareHouseId);

    List<List<?>> getReportInventoryList(@Param("wareHouseId") Long wareHouseId, @Param("customer_id") Long customer_id, @Param("maName") String maName, @Param("locationCode") String locationCode, @Param("page") Integer page, @Param("pageSize") Integer pageSize);

    List<Materiel> getInventoryInfoList(@Param("mid") String mid);

    List<Materiel> getStockInventoryInfoDetailedList(@Param("mid") String mid, @Param("mBatch") String mBatch, @Param("page") Integer page, @Param("pageSize") Integer pageSize, @Param("wareHouseId") Long wareHouseId);

    Integer getReportFormJinListTotal(@Param("date") String date, @Param("maName") String maName, @Param("customer_id") Long customer_id, @Param("selectTime") String selectTime, @Param("selectType") String selectType, @Param("selectTime2") String selectTime2, @Param("stockId") Long stockId);

    Integer getReportFormChungListTotal(@Param("date") String date, @Param("maName") String maName, @Param("customer_id") Long customer_id, @Param("selectTime") String selectTime, @Param("selectType") String selectType, @Param("selectTime2") String selectTime2, @Param("stockId") Long stockId);

    Integer getReportFormReTurnListTotal(@Param("date") String date, @Param("maName") String maName, @Param("customer_id") Long customer_id, @Param("selectTime") String selectTime, @Param("selectType") String selectType, @Param("dateTime2") String dateTime2, @Param("stockId") Long stockId);

    Integer getReportFormReGeLIListTotal(@Param("date") String date, @Param("maName") String maName, @Param("customer_id") Long customer_id, @Param("selectTime") String selectTime, @Param("selectType") String selectType, @Param("selectTime2") String selectTime2, @Param("stockId") Long stockId);

    //Integer getMonthBalanceTotal(@Param("firsTime") Date firsTime, @Param("ma_id") String ma_id, @Param("customer_id") Long customer_id,@Param("selectTime2") String selectTime2,@Param("date") String date);

    @Select("select id,customer_name,customer_num from lz_customer where \tcustomer_type = 0 and warehouse_id = #{wareHouseId}")
    List<Customer> selectAllCustomerList(Long wareHouseId);

    List<Materiel> getTiaoMaList(@Param("mBatch") String mBatch, @Param("mid") String mid, @Param("locationCode") String locationCode);

    Integer getStockInventoryInfoDetailedListTotal(@Param("mid") String mid, @Param("mBatch") String mBatch, @Param("wareHouseId") Long wareHouseId);

    List<Materiel> getReceiveDetail(@Param("dateTime") String dateTime, @Param("materiaId") Long materiaId);

    List<Materiel> getChuKuDetail(@Param("dateTime") String dateTime, @Param("materiaId") Long materiaId);

    List<Materiel> getReturnDetail(@Param("dateTime") String dateTime, @Param("materiaId") Long materiaId);

    List<Materiel> getTuiHui(@Param("dateTime") String dateTime, @Param("materiaId") Long materiaId);

    List<ReportFormEntity> getStock();

    void addStockTaskJob(List<ReportFormEntity> list);

    @Select("select zc_system_user.userName from jy_receive re ,  zc_system_user  where receive_number = #{brevity_num} and zc_system_user.id = receive_name")
    String getMan(String brevity_num);


    String getTiaomaOut_date(String materiel_num);

    List<Materiel> getMaterListStrWhere(@Param("wareHouseId") Long wareHouseId, @Param("customerId") long customerId);

    /**
     * 获取所有的库位
     * @param wareHouseId
     * @return
     */
    List<WarehouseRegionLocation> getstoreHouse(@Param("wareHouseId") Long wareHouseId);
}
